home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / var / lib / dpkg / info / procps.preinst < prev    next >
Text File  |  2009-09-15  |  2KB  |  87 lines

  1. #!/bin/sh
  2. # preinst script for procps
  3. #
  4. # see: dh_installdeb(1)
  5.  
  6. set -e
  7.  
  8. # summary of how this script can be called:
  9. #        * <new-preinst> `install'
  10. #        * <new-preinst> `install' <old-version>
  11. #        * <new-preinst> `upgrade' <old-version>
  12. #        * <old-preinst> `abort-upgrade' <new-version>
  13. # for details, see http://www.debian.org/doc/debian-policy/ or
  14. # the debian-policy package
  15.  
  16. prep_mv_conffile()
  17. {
  18.   PKGNAME=$1
  19.   CONFFILE=$2
  20.  
  21.   if [ -e "$CONFFILE" ]; then
  22.     md5sum="`md5sum \"$CONFFILE\" | sed -e \"s/ .*//\"`"
  23.     old_md5sum="`dpkg-query -W -f='${Conffiles}' $PKGNAME | sed -n -e \"\\\\' $CONFFILE'{s/ obsolete$//;s/.* //p}\"`"
  24.     if [ "$md5sum" = "$old_md5sum" ]; then
  25.       rm -f "$CONFFILE"
  26.     fi
  27.   fi
  28. }
  29.  
  30. upgradeoldconffile()
  31. {
  32.   f=/etc/init.d/procps.sh
  33.   [ ! -e "$f" ] && return
  34.  
  35.   curmd5=`md5sum "$f" |awk '{print $1}'`
  36.   oldmd5=`dpkg-query -W -f='${Conffiles}' procps | sed "{\\'^ $f ' ! d; s///}"`
  37.   [ "$curmd5" = "$oldmd5" ] && {
  38.       # The admin has not modified $f
  39.       echo "Preparing to remove obsolete, unmodified conffile: $f"
  40.       mv -fv "$f" "$f.from-preinst"
  41.       return
  42.     } >&2
  43.  
  44.     # The admim modified $f; cause a deliberate conffile prompt
  45.     echo "Moving obsolete conffile to new pathname:"
  46.     mv -fv "$f" "${f%.sh}"
  47. }
  48.  
  49.  
  50. case "$1" in
  51.     install)
  52.     ;;
  53.     upgrade)
  54.       prep_mv_conffile procps "/etc/init.d/procps.sh"
  55.     ;;
  56.     abort-upgrade)
  57.     ;;
  58.  
  59.     *)
  60.         echo "preinst called with unknown argument \`$1'" >&2
  61.         exit 1
  62.     ;;
  63. esac
  64.  
  65. # dh_installdeb will replace this with shell code automatically
  66. # generated by other debhelper scripts.
  67.  
  68. # Automatically added by dh_installinit
  69. if [ "$1" = install ] || [ "$1" = upgrade ]; then
  70.     if [ -e "/etc/init.d/procps" ] && [ ! -L "/etc/init.d/procps" ]; then
  71.         if [ "`md5sum \"/etc/init.d/procps\" | sed -e \"s/ .*//\"`" != \
  72.              "`dpkg-query -W -f='${Conffiles}' procps | sed -n -e \"\\\\' /etc/init.d/procps '{s/ obsolete$//;s/.* //p}\"`" ]
  73.         then
  74.             echo "Obsolete conffile /etc/init.d/procps has been modified by you, renaming to .dpkg-bak"
  75.             mv -f "/etc/init.d/procps" "/etc/init.d/procps.dpkg-bak"
  76.         else
  77.             rm -f "/etc/init.d/procps"
  78.         fi
  79.     fi
  80. fi
  81. # End automatically added section
  82.  
  83.  
  84. exit 0
  85.  
  86.  
  87.